package com.gg.user.gguser.controller;


import com.gg.user.gguser.service.GgInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/information")
public class GgInformationController {

    @Autowired
    private GgInformationService ggInformationService;

    /**
     * 获取信息列表
     */
    @PostMapping("/getInformationSelectList")
    public Object getInformationSelectList(HttpServletResponse response, HttpServletRequest request,@RequestParam("page") Integer page, @RequestParam("pageNumber")Integer pageNumber,@RequestParam(name = "name" ,required = false) String name,@RequestParam(name = "type" ,required = false) Integer type,@RequestParam(name = "state" ,required = false) Integer state,@RequestParam(name = "remarks" ,required = false) String remarks){
        return ggInformationService.getInformationSelectList(response,request,page, pageNumber,name,type,state,remarks);
    }

    /**
     * 获取单个
     */
    @PostMapping("/getInformationSelectItems")
    public Object getInformationSelectItems(@RequestParam("itemsId") String itemsId){
        return ggInformationService.getInformationSelectItems(itemsId);
    }

    /**
     * 单个增加信息
     */
    @PostMapping("/addInformationAll")
    public Object addInformationAll(HttpServletResponse response, HttpServletRequest request, String name, String sex, @RequestParam(name = "position", required = false) String position, String phone, @RequestParam(name = "mailbox", required = false) String mailbox, @RequestParam(name = "qq", required = false) String qq, @RequestParam(name = "weChat", required = false) String weChat, @RequestParam(name = "provid", required = false) String provid, @RequestParam(name = "cityid", required = false) String cityid, @RequestParam(name = "areaid", required = false) String areaid, @RequestParam(name = "address", required = false) String address, @RequestParam(name = "level", required = false) Integer level, @RequestParam(name = "state", required = false) Integer state, @RequestParam(name = "remarks", required = false) String remarks, @RequestParam(name = "username", required = false) String username, @RequestParam(name = "fax", required = false) String fax, @RequestParam(name = "contact", required = false) String contact, @RequestParam(name = "zipcode", required = false) String zipcode, @RequestParam(name = "website", required = false) String website, @RequestParam(name = "source", required = false) String source) throws Exception {
        return ggInformationService.addInformationAll(response, request, name, sex, position, phone, mailbox, qq, weChat, provid, cityid, areaid, address, level, state, remarks, username, fax, contact, zipcode, website, source);
    }

    /**
     * 修改信息
     */
    @PostMapping("/updateInformation")
    public Object updateInformation(HttpServletResponse response, HttpServletRequest request, String ggItemsToken, @RequestParam(name = "ggIName", required = false) String ggIName, @RequestParam(name = "ggIProvince", required = false)String ggIProvince,@RequestParam(name = "ggICity", required = false) String ggICity,@RequestParam(name = "ggIAreaid", required = false)String ggIAreaid, @RequestParam(name = "ggIDetailed", required = false)String ggIDetailed, @RequestParam(name = "ggIHandle", required = false)String ggIHandle, @RequestParam(name = "ggIContact", required = false)String ggIContact, @RequestParam(name = "ggIState", required = false)Integer ggIState, @RequestParam(name = "ggILevel", required = false)Integer ggILevel, @RequestParam(name = "ggIGender", required = false)String ggIGender, @RequestParam(name = "ggIPosition", required = false)String ggIPosition, String ggITelephone, @RequestParam(name = "ggIFax", required = false)String ggIFax, @RequestParam(name = "ggIMailbox", required = false)String ggIMailbox, @RequestParam(name = "ggIQq", required = false)String ggIQq, @RequestParam(name = "ggIWechat", required = false)String ggIWechat, @RequestParam(name = "ggIZipcode", required = false)String ggIZipcode, @RequestParam(name = "ggIWebsite", required = false)String ggIWebsite, @RequestParam(name = "ggISource", required = false)String ggISource) throws Exception {
        return ggInformationService.updateInformation(response, request, ggItemsToken, ggIName, ggIProvince, ggICity, ggIAreaid, ggIDetailed, ggIHandle, ggIContact, ggIState, ggILevel, ggIGender, ggIPosition, ggITelephone, ggIFax, ggIMailbox, ggIQq, ggIWechat,ggIZipcode,ggIWebsite,ggISource);
    }

    /**
     * 删除信息
     */
    @PostMapping("/delectInformation")
    public Object delectInformation(HttpServletResponse response, HttpServletRequest request,Integer id) throws Exception{
        return ggInformationService.delectInformation(response,request,id);
    }

    /**
     * 批量删除
     */
    @PostMapping("/delectInformationAll")
    public Object delectInformationAll(HttpServletResponse response, HttpServletRequest request,String listid) throws Exception{
        return ggInformationService.delectInformationAll(response,request,listid);
    }

    /**
     * 批量加入商机
     */
    @PostMapping("/removebusinessAll")
    public Object removebusinessAll(HttpServletResponse response, HttpServletRequest request,String listid) throws Exception {
        return ggInformationService.removebusinessAll(response,request,listid);
    }

    /**
     * 批量移入签约
     */

}
